#ifndef SINGLETON_H_
#define SINGLETON_H_

template <class T>
class Singleton
{
public:
	static T * getInstance()
	{
		if(Singleton<T>::instance == 0)
			Singleton<T>::instance = new T;

		return Singleton<T>::instance;
	}

	static void deleteInstance()
	{
		if(Singleton<T>::instance != 0)
		{
			delete Singleton<T>::instance;
			Singleton<T>::instance = 0;
		}
	}

protected:
	Singleton() {};

private:
	static T * instance;
};

template <class T> T * Singleton<T>::instance = 0;


#endif /* SINGLETON_H_ */
